﻿Imports System.Data
Imports VSModel
Imports AutoDevModel
Imports Cls_Common
Imports SecurityService
Partial Class Control_TiepNhanMCC_XuLyLoai
    Inherits System.Web.UI.UserControl
    Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim script As ScriptManager = ScriptManager.GetCurrent(Me.Page)
            If Not script Is Nothing AndAlso script.IsInAsyncPostBack Then
                ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "duyjs", "ajaxJquery()", True)
            Else
                Me.Page.ClientScript.RegisterStartupScript(Me.Page.GetType(), "duyjs", String.Concat("Sys.Application.add_load(function(){", "ajaxJquery()", "});"), True)
            End If
            If Session("UserId") Is Nothing Then
                Response.Redirect("~/Login.aspx")
            End If
            hidCurHuyenId.Value = Session("HuyenId")
            hidID.Value = Request("Id")

            Using _mc As New AutoDevEntities

                Dim _motcua = (From q In _mc.HoSoes Where q.Id = hidID.Value Select q).FirstOrDefault
                If Not _motcua Is Nothing Then
                    If _motcua.TypeId = 1 Then 'TypeId = 1 chấm dứt
                        Response.Redirect("../../Page/QuanLyHoSo/MotCuaImportChamDut.aspx?Id=" & hidID.Value & "&CMND=" & _motcua.CMND)
                    ElseIf _motcua.TypeId = 3 Then 'TypeId = 3 cấp đổi
                        Response.Redirect("../../Page/QuanLyHoSo/MotCuaImportCapDoi.aspx?Id=" & hidID.Value & "&CMND=" & _motcua.CMND)
                    Else ' TypeId = 2 cấp mới
                        Response.Redirect("../../Page/QuanLyHoSo/MotCuaImport.aspx?Id=" & hidID.Value)
                    End If
                End If
            End Using
        End If
    End Sub
End Class
